<?php
    namespace app\index\controller;
    
    use think\Controller;
    use think\Db;
    
    class Index extends Controller
    {
        public function _initialize()
        {
            ip_pv();
        }
        public function index()
        {
            $class = Db::table('class')
            ->select();
            return $this->fetch(null, ['class' => $class]);
        }
        public function GetList()
        {
            $name = $_POST['name'];
            $info = Db::table('class')
            ->where("`name`='$name'")
            ->find();
            if ($info) {
                $list = Db::table('name')
                ->where("`class_id` = '$info[id]'")
                ->field('name,size,add_time')
                ->select();
            }
            $this->success($list);
        }
        public function GetHomeList()
        {
            $class = Db::table('class')
            ->select();
            $this->success($class);
        }
        public function GetInfo()
        {
            # 获取下载地址
            $info = Db::table('name')
            ->where("`name` = '$_POST[name]'")
            ->field('link,info')
            ->find();
            $this->success($info);
        }
    }
